package com.zrgk.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.zrgk.bean.ConSurveyBean;
import com.zrgk.dao.ConSurveyDao;
import com.zrgk.util.PageUtil;



@Service(value = "conSurveyService")
@Transactional(propagation = Propagation.REQUIRED)
public class ConSurveyServiceImpl implements ConSurveyService{
	@Autowired
	@Qualifier("conSurveyDao")
	private ConSurveyDao conSurveyDao;

	public List<ConSurveyBean> listConSurvey() {
	
		return conSurveyDao.listConSurvey();
	}

	public void insertConSurvey(ConSurveyBean cons) {
		
		conSurveyDao.insertConSurvey(cons);	
	}

	public void updateConSurvey(ConSurveyBean cons) {
		
		conSurveyDao.updateConSurvey(cons);
	}

	public void findConSurveyByPage(PageUtil pageUtil) {
//		Page page = PageHelper.startPage((pageUtil.getNowPage()-1)*pageUtil.getPageSize(),pageUtil.getPageSize());
		List<ConSurveyBean> cons = conSurveyDao.listConSurvey();
		for(ConSurveyBean c:cons){
			System.out.println(c);
		}
		pageUtil.setList(cons);
//		pageUtil.setTotalCount(page.getPages());
//		pageUtil.setTotalPage((int)page.getTotal());	
		
		
	}

	public ConSurveyBean findConSurveyById(int id) {
		
		return conSurveyDao.ConSurveyById(id);
	}

}
